
import java.util.Random;
import java.util.Scanner;

public class 猜数字游戏 {
    public static void main(String[] args) {

        Random r = new Random();
        int number = r.nextInt(100);
        // 生成任意区间的随机数
        // int number2 = r.nextInt(15 - 7 + 1) + 7;
        // System.out.println(number2);

        Scanner sc = new Scanner(System.in);

        while (true) {
            System.out.println("请输入你猜的数字：");

            int cai = sc.nextInt();
            if (cai > number) {
                System.out.println("你猜的数字大了");

            } else if (cai < number) {
                System.out.println("你猜的数字小了");

            } else {
                System.out.println("你猜对了");
                break;
            }
        }
        sc.close();

    }

}
